﻿using System;
using System.Diagnostics;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using HYCodeBase.WinForm;
using RevitInteractiveUtility.ExternalEventManager;

namespace SampleAndTest.ExternalEventManager.SingleFromDemo
{
	[Transaction(TransactionMode.Manual)]
	public class CmdTestExternalEventSingleForm : IExternalCommand
	{
		public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
		{
			try
			{
				WindowHandle owner = new WindowHandle(Process.GetCurrentProcess().MainWindowHandle);
				ExternalEventManagerSingleton.GetEventManger(false).ReSetRequest();
				CmdTestExternalEventSingleForm.m_form = new SingleForm(commandData);
				CmdTestExternalEventSingleForm.m_form.Show(owner);
			}
			catch
			{
			}
			return Autodesk.Revit.UI.Result.Succeeded;
		}

		internal static SingleForm m_form;
	}
}
